#ifndef FILEPICKER_H
#define FILEPICKER_H

#include <QObject>
#include <QString>
#include <QTime>
#include <QStandardPaths>
#include <QFile>

enum LocationDirType {
    DesktopDir,
    DocumentsDir,
    FontsDirn,
    ApplicationsDir,
    MusicDir,
    MoviesDir,
    PicturesDir,
    TempDir,
    HomeDir,
    AppLocalDataDir,
    CacheDir,
    GenericDataDir,
    RuntimeDir,
    ConfigDir,
    DownloadDir,
    GenericCacheDir,
    GenericConfigDir,
    AppDataDir,
    AppConfigDir,
    PublicShareDir,
    TemplatesDir,
    StateDir,
    GenericStateDir,
};

struct FileModel{
    QString path;

    QString name;

    QString fold;

    qint64 size;

    QString format;

    QDateTime createDate;

    QDateTime editDate;

    QString createTime() {
        QDate date = createDate.date();
        QTime time = createDate.time();
        return QString::number(date.year()).append("-").append(QString::number(date.month())).append("-").append(QString::number(date.day())).append(" ").append(QString::number(time.hour())).append(":").append(QString::number(time.minute())).append(":").append(QString::number(time.second()));
    }

    QString editTime() {
        QDate date = editDate.date();
        QTime time = editDate.time();
        return QString::number(date.year()).append("-").append(QString::number(date.month())).append("-").append(QString::number(date.day())).append(" ").append(QString::number(time.hour())).append(":").append(QString::number(time.minute())).append(":").append(QString::number(time.second()));
    }

    QFile file() {
        return QFile(path);
    }

};

class FilePicker : public QObject
{
    Q_OBJECT
public:
    explicit FilePicker(QObject *parent = nullptr);

    static QList<FileModel> pickFiles();

    static FileModel pickFile();

    static QList<FileModel> pickDirType(LocationDirType type = DesktopDir);

    static QList<FileModel> pickDirPath(QString dirPath = FilePicker::locationPath(DesktopDir));

    static QString locationPath(LocationDirType type);

signals:
};

#endif // FILEPICKER_H
